<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>操作属性</title>
	</head>
	<body>
		<div id="d01">这是一个div</div>
		<a id="a01" href="//www.hunau.com.edu">湖南农业大学</a>
		<button id="btn01">获得href</button><button id="btn02">修改href</button><button id="btn03">移除href</button>
		<br>
		<input type="text" class="username">
		<button id="btn04">获得value</button>
		<button id="btn05">修改value</button>
		<div id="d02">
			<p>div-p<span>p-span</span></p>
		</div>
		<button id="btn06">获得HTML</button>
		 <button id="btn07">修改HTML</button>
		<script src="./js/jQuery/jquery-3.4.1.js"></script>
		<script>
		 $(function(){
			 $("#btn01").click(function(){
				 var a=$("#a01");
				 var href=a.attr("href");
				 console.log(href);
			 });
			 
			 $("#btn02").click(function(){
			 				 var a=$("#a01");
			 				 a.attr("href","//www.baidu.com");
			 				// console.log(href);
			 });
			 
			 $("#btn03").click(function(){
			 				 var a=$("#a01");
			 				 a.removeAttr("href");
			 				// console.log(href);
			 });
			 
			 $("#btn04").click(function(){
			 	console.log($(".username").val());
			 });
			 $("#btn05").click(function(){
			 	 $(".username").val("又到了周末"); 
			 });
			 
			 $("#btn06").click(function(){
			 	 console.log($("#d02").html()); 
				 console.log($("#d02").text()); 
			 });
			 $("#btn07").click(function(){
			 	 $("#d02").html("<h1>修改的内容</h1>") ; 
			 });
			 
		 }); 
		</script>
	</body>
</html>
